﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="StockFileSearch.ascx.cs" Inherits="GPSTrackingWebsiteManager.Manager.UserControls.StockFileSearch" %>
<style type="text/css">
    .auto-style1 {
        width: 100%;
    }
</style>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">

        function OpenStockFileSearch() {
            var wnd = $find('<%=rwStockFile.ClientID %>');
            wnd.show();
        }

        function CloseStockFileSearch() {
            var wnd = $find('<%=rwStockFile.ClientID %>');
            wnd.close();
        }

    </script>
</telerik:RadScriptBlock>
<telerik:RadWindow ID="rwStockFile" Title="Buscador de Archivos"  runat="server" Width="750px" Height="470px" EnableShadow="true" Behaviors="Close" ShowContentDuringLoad="false" VisibleStatusbar="false" Modal="true">
    <ContentTemplate>
        <table class="auto-style1">
            <tr>
                <td>Nombre </td>
                <td>Nombre del Archivo</td>
            </tr>
            <tr>
                <td>
                    <telerik:RadTextBox ID="txtName" runat="server" Width="100%">
                    </telerik:RadTextBox>
                </td>
                <td>
                    <telerik:RadTextBox ID="txtFileName" runat="server" Width="100%">
                    </telerik:RadTextBox>
                </td>
            </tr>

            <tr>
                <td style="text-align: center" colspan="2">
                    <telerik:RadButton ID="btnStockFileSearch" runat="server" Text="Buscar" OnClick="btnStockFileSearch_Click">
                    </telerik:RadButton>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <telerik:RadGrid ID="StockFileSearchGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Height="290px" AllowSorting="true">
                        <ClientSettings EnableRowHoverStyle="true">
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                            <Selecting AllowRowSelect="True"></Selecting>
                        </ClientSettings>
                        <MasterTableView NoMasterRecordsText="No hay registros encontrados">
                            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>

                            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>

                            <Columns>
                                 <telerik:GridClientSelectColumn DataType="System.Boolean" FilterControlAltText="Filter Selected column" UniqueName="Selected" ItemStyle-Width="40px" HeaderStyle-Width="40px" HeaderStyle-HorizontalAlign="Center">
                                    </telerik:GridClientSelectColumn>
                                <telerik:GridBoundColumn DataField="CompanyId" FilterControlAltText="Filter Imei column" HeaderText="CompanyId" UniqueName="CompanyId" Display="false" ReadOnly="true" ForceExtractValue="Always">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="StockFileId" FilterControlAltText="Filter Imei column" HeaderText="StockFileId" UniqueName="StockFileId" ReadOnly="true" Display="false" ForceExtractValue="Always">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter Name column" HeaderText="Nombre" UniqueName="Name" MaxLength="50"
                                    FilterControlWidth="300px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="320px" AutoPostBackOnFilter="true">                                  
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="Archivo" UniqueName="Filename" DataField="Filename" ForceExtractValue="Always"
                                    FilterControlWidth="230px" CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="250px" AutoPostBackOnFilter="true">
                                    <ItemTemplate>
                                        <asp:Label ID="lblFilename" runat="server" Text='<%# Eval("Filename") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadAsyncUpload ID="RadUpload1" ToolTip='<%# Eval("Filename") %>' InitialFileInputsCount="1" Localization-Select="Buscar" OverwriteExistingFiles="true" ControlObjectsVisibility="None" runat="server"
                                            OnClientFileUploaded="OnClientFileUploaded">
                                        </telerik:RadAsyncUpload>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridDropDownColumn DataField="StockFileTypeOfFileId"  DataSourceID="sdsFileType" FilterControlAltText="Filter GPSTypeID column" HeaderText="Tipo" ListTextField="Name" ListValueField="StockFileTypeOfFileId" UniqueName="StockFileTypeOfFileId">
                                    <FilterTemplate>
                                        <telerik:RadComboBox ID="cmbFileType" DataSourceID="sdsFileType" DataTextField="Name" DataValueField="StockFileTypeOfFileId" Width="100px"
                                            AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("StockFileTypeOfFileId").CurrentFilterValue %>'
                                            runat="server" OnClientSelectedIndexChanged="FileTypeIdIndexChanged" Sort="Ascending">
                                            <Items>
                                                <telerik:RadComboBoxItem Text="Todos" Value="" />
                                            </Items>
                                        </telerik:RadComboBox>
                                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
                                            <script type="text/javascript">
                                                function FileTypeIdIndexChanged(sender, args) {
                                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                                tableView.filter("StockFileTypeOfFileId", args.get_item().get_value(), "EqualTo");
                                            }
                                            </script>
                                        </telerik:RadScriptBlock>
                                    </FilterTemplate>
                                </telerik:GridDropDownColumn>
                            </Columns>
                        </MasterTableView>
                        <FilterMenu EnableImageSprites="False"></FilterMenu>
                    </telerik:RadGrid>
                </td>
            </tr>
            <tr>
                <td style="text-align: center" colspan="2">
                    <telerik:RadButton ID="btnStockFileOK" runat="server" Text="Aceptar" OnClick="btnStockFileOK_Click" OnClientClicked="CloseStockFileSearch"></telerik:RadButton>
                    <telerik:RadButton ID="btnStockFileCancel" runat="server" Text="Cancelar" OnClick="btnStockFileCancel_Click" OnClientClicked="CloseStockFileSearch"></telerik:RadButton>
                </td>
            </tr>
        </table>
    </ContentTemplate>
</telerik:RadWindow>
<asp:SqlDataSource ID="sdsFileType" SelectCommandType="StoredProcedure" SelectCommand="StockFilesTypeOfFile_Get_List" runat="server"></asp:SqlDataSource>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnStockFileSearch">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="StockFileSearchGrid" LoadingPanelID="RadAjaxLoadingPanel1" UpdatePanelCssClass="" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnStockFileOK">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="StockFileSearchGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnStockFileCancel">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="StockFileSearchGrid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
